package mil.af.amc.adpetracker.model;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Id;
import javax.persistence.Column;

/**
 * Represents a military rank
 *
 * This class should be mapped to the COMMONS CL_PAY_GRADE_RANK table
 *
 * @author TSgt Jason Ferguson
 */

@Entity
@Table(name="CL_PAY_GRADE_RANK", schema = "COMMON")
@Cache(usage = CacheConcurrencyStrategy.READ_ONLY)
public class Rank {

    private int id;
    private String abbreviation;
    private String grade;
    private String name;
    private String service;
    private int sortOrder;

    @Id
    @Column(name="CL_SEQNBR")
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Column(name="cl_rankabbr")
    public String getAbbreviation() {
        return abbreviation;
    }

    public void setAbbreviation(String abbreviation) {
        this.abbreviation = abbreviation;
    }

    @Column(name="cl_paygradedesctxt")
    public String getGrade() {
        return grade;
    }

    public void setGrade(String grade) {
        this.grade = grade;
    }

    @Column(name="cl_rankdesctxt")
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Column(name="cl_usocdesctxt")
    public String getService() {
        return service;
    }

    public void setService(String service) {
        this.service = service;
    }

    @Column(name="cl_sortorder")
    public int getSortOrder() {
        return sortOrder;
    }

    public void setSortOrder(int sortOrder) {
        this.sortOrder = sortOrder;
    }

    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        final Rank rank = (Rank) o;

        if (id != rank.id) return false;

        return true;
    }

    public int hashCode() {
        return id;
    }
}
